import { http } from "@/utils/http";
import { baseUrlApi } from "../utils";

interface RoleModules {
  status: number;
  msg: string;
  data: [
    {
      moduleId: string;
      moduleName: string;
      roleId: string;
      roleName: string;
      code: string;
    }
  ];
  success: boolean;
}

interface MenuByDicId {
  status: number;
  msg: string;
  data: [
    {
      id: string;
      displayName: string;
      code: string;
      parentId: string;
      moudleId: string;
      path: string;
      childrens: object;
    }
  ];
  success: boolean;
}

interface PagedAndSort {
  status: number;
  msg: string;
  data: {
    items: [
      {
        id: string;
        name: string;
        gender: boolean;
        age: number;
        nation: string;
        idCard: string;
        phone: string;
        email: string;
        marriage: string;
        province: string;
        ipAddress: string;
        homeAddress: string;
        educationLevel: number;
        job: string;
        competent: string;
        annualIncome: number;
        mothlyIncome: number;
        health: string;
        guaranteeMode: string;
        installmentRate: number;
        loanTerm: number;
        overdueTimes: number;
        createTime: string;
      }
    ];
    totalCount: number;
  };
  success: boolean;
}

interface reportPagedAndSort {
  status: number;
  msg: string;
  data: {
    items: [
      {
        id: string;
        personalcreditreportId: string;
        name: string;
        reportNo: string;
        queryDate: string;
        planId: string;
        taskId: string;
        userId: string;
        createTime: string;
      }
    ];
    totalCount: number;
  };
  success: boolean;
}

interface EnterGetAllByPagedAndSort {
  status: number;
  msg: string;
  data: {
    items: [
      {
        id: string;
        enterpriseName: string;
        registerAddress: string;
        registerType: number;
        registerNo: string;
        registerDate: string;
        endDate: string;
        organizationCode: string;
        strikeCode: string;
        nationalTaxNo: string;
        landTaxNo: string;
        createTime: string;
      }
    ];
    totalCount: number;
  };
  success: boolean;
}

interface GetReport {
  status: number;
  msg: string;
  data: boolean;
  success: boolean;
}

interface SelectPersonalReport {
  status: number;
  msg: string;
  data: string;
  success: boolean;
}

// 通过字典获取菜单集合
export const GetRoleModules = (params: string) => {
  return http.request<RoleModules>(
    "get",
    baseUrlApi("/Menu/GetRoleModules?moduleId=" + params)
  );
};

// 通过字典获取菜单集合
export const GetMenuByDicId = (params: string) => {
  return http.request<MenuByDicId>(
    "get",
    baseUrlApi("/Menu/GetMenuByDicId?" + params)
  );
};

// 获取个人征信数据系统
export const PersonGetAllByPagedAndSort = (data: object) => {
  return http.request<PagedAndSort>(
    "post",
    baseUrlApi("/Personalcreditreport/GetAllByPagedAndSort"),
    {
      data
    }
  );
};

// 获取个人征信报告
export const GetPersonalreportByPagedAndSort = (data: object) => {
  return http.request<reportPagedAndSort>(
    "post",
    baseUrlApi("/Personalcreditreport/GetPersonalreportByPagedAndSort"),
    {
      data
    }
  );
};

// 获取企业征信数据

export const EnterGetAllByPagedAndSort = (data: object) => {
  return http.request<EnterGetAllByPagedAndSort>(
    "post",
    baseUrlApi("/Enterpriseinformation/GetAllByPagedAndSort"),
    {
      data
    }
  );
};

// 获取征信报告  -- 申请表

export const GetReport = (data: object) => {
  return http.request<GetReport>(
    "post",
    baseUrlApi("/Personalcreditreport/GetReport"),
    {
      data
    }
  );
};

// 通过字典获取菜单集合
export const GetMoudleKeyValue = (params: string) => {
  return http.request<MenuByDicId>(
    "post",
    baseUrlApi("/SubmoduleKeywrod/GetMoudleKeyValue?" + params)
  );
};

// 查看个人征信报告详情
export const SelectPersonalReport = (data: object) => {
  return http.request<SelectPersonalReport>(
    "post",
    baseUrlApi("/Personalcreditreport/SelectPersonalReport"),
    {
      data
    }
  );
};

// 查看企业征信报告
export const EnterpriseinformationSelectEnterpriseCreditReport = (
  params: string
) => {
  return http.request<any>(
    "get",
    baseUrlApi("/Enterpriseinformation/SelectEnterpriseCreditReport?" + params)
  );
};

// 获取企业代表人授权委托书
export const GetEnterpriseentrustByRId = (params: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/Enterpriseinformation/GetEnterpriseentrustByRId?" + params)
  );
};

// 【企业征信中心】获取征信报告
export const GetEnterpriseCreditReport = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/Enterpriseinformation/GetEnterpriseCreditReport"),
    {
      data
    }
  );
};

// 获取模型列表数据 个人
export const GetPersonalCreditData = () => {
  return http.request<any>(
    "get",
    baseUrlApi("/Enterpriseinformation/GetPersonalCreditData")
  );
};

// 获取模型列表数据 企业
export const GetEnterpriseCreditData = () => {
  return http.request<any>(
    "get",
    baseUrlApi("/Enterpriseinformation/GetEnterpriseCreditData")
  );
};

// 获取企业已申请征信记录的企业列表
export const GetAllEnterprisereportInfo = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/Enterpriseinformation/GetAllEnterprisereportInfo"),
    { data }
  );
};

// 提交个人评分模型
export const CreatePersonalCreditModel = (data: object) => {
  return http.request<any>("post", baseUrlApi("/PersonalCreditModel/Create"), {
    data
  });
};

// 提交企业评分模型
export const CreateEnterpriseCreditModel = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/EnterpriseCreditModel/Create"),
    {
      data
    }
  );
};

// 申请企业信用测评
export const CreditScoreMeasurement = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/EnterpriseCreditScoreMeasurement/Create"),
    {
      data
    }
  );
};

//
export const GetAllByPagedAndSort = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/EnterpriseCreditScoreMeasurement/GetAllByPagedAndSort"),
    {
      data
    }
  );
};

// 获取企业下拉选项列表
export const EnterpriseCreditScoreMeasurementAGellt = (params: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/EnterpriseCreditScoreMeasurement/GetAll?" + params)
  );
};

// 获取个人下拉选项列表
export const PersonalCreditScoreMeasurementGetAll = (params: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/PersonalCreditScoreMeasurement/GetAll?" + params)
  );
};

//获取测算企业列表  企业信用测算表
export const GetEnterpriseNamesOptions = () => {
  return http.request<any>(
    "get",
    baseUrlApi("/Enterpriseinformation/GetEnterpriseNamesOptions")
  );
};

//获取测算企业模型  企业信用测算表
export const GetEnterpriseModelNameOptions = (params: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/EnterpriseCreditModel/GetEnterpriseModelNameOptions?" + params)
  );
};

//测算模型结果 企业信用测算表
export const CalculateEnterpriseCredit = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/Enterpriseinformation/CalculateEnterpriseCredit"),
    {
      data
    }
  );
};

// 查看评分模板详情
export const ShowTreeNodeInfo = (params: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/EnterpriseCreditModel/ShowTreeNodeInfo?" + params)
  );
};

// 获取测算模型结果
export const EnterpriseCreditResultGetAllByPagedAndSort = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/EnterpriseCreditResult/GetAllByPagedAndSort"),
    {
      data
    }
  );
};

export const EnterpriseCreditModelGetAllByPagedAndSort = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/EnterpriseCreditModel/GetAllByPagedAndSort"),
    {
      data
    }
  );
};

// 获取企业信用评分详情
export const EnterpriseCreditResultDGaeeilstt = (params: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/EnterpriseCreditResult/GetDetails?" + params)
  );
};

// 获取企业信用评分详情
export const PersonalCreditModelShowPerSonTreeNodeInfo = (params: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/PersonalCreditModel/ShowPerSonTreeNodeInfo?" + params)
  );
};

// 新增个人评分模型
export const PersonalCreditScoreMeasurementCreate = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/PersonalCreditScoreMeasurement/Create"),
    {
      data
    }
  );
};

// 获取个人信用申请模型分页查询;
export const PersonalCreditModelGetAllByPagedAndSort = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/PersonalCreditModel/GetAllByPagedAndSort"),
    {
      data
    }
  );
};

// 分页获取个人信用测评分全部数据
export const PersonalCreditScoreMeasurementGetAllByPagedAndSort = (
  data: object
) => {
  return http.request<any>(
    "post",
    baseUrlApi("/PersonalCreditScoreMeasurement/GetAllByPagedAndSort"),
    {
      data
    }
  );
};

// 个人信用成绩测试
export const PersonalCreditScoreMeasurementCalculatePersonalCredit = (
  data: object
) => {
  return http.request<any>(
    "post",
    baseUrlApi("/PersonalCreditScoreMeasurement/CalculatePersonalCredit"),
    {
      data
    }
  );
};

// 获取个人信用申请名称 模型名称
export const PersonalCreditModelGetPersonalCreditModelNames = (params: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/PersonalCreditModel/GetPersonalCreditModelNames?" + params)
  );
};

// 获取个人征信名称成功
export const PersonalcreditreportGetPersonalcreditReportNames = () => {
  return http.request<any>(
    "get",
    baseUrlApi("/Personalcreditreport/GetPersonalcreditReportNames")
  );
};

//获取菜单钱包
export const FinancialTransactionsUsers = (params: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/FinancialTransactionsUsers/Get?" + params)
  );
};

export const TransactionsOredrsRechargeRMB = (params: string) => {
  return http.request<any>(
    "post",
    baseUrlApi("/TransactionsOredrs/RechargeRMB?" + params)
  );
};

export const TransactionsOredrsGetBillingDetails = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/TransactionsOredrs/GetBillingDetails"),
    {
      data
    }
  );
};

// 获取已经锁定的供应商成功  -- 甲方
export const SupplierEnterpriseInfoGetLockedInfo = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/SupplierEnterpriseInfo/GetLockedInfo"),
    {
      data
    }
  );
};

//供应商初始化

export const InitializeData = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/FinancialTransactionsUsers/InitializeData"),
    {
      data
    }
  );
};
